import api from '../../api/patientInfo.js'

const state = {

}

const actions = {
    //查询
    patientInfoList({ commit }, params) {
        return new Promise((resolve, reject) => {
            api.patientInfoList(params).then(res => {
                resolve(res)
            }).catch(error => {
                reject(error)
            })
        })
    },
    //查询ALL
    patientInfoListAll() {
        return new Promise((resolve, reject) => {
            api.patientInfoListAll().then(res => {
                resolve(res)
            }).catch(error => {
                reject(error)
            })
        })
    },
    //查询Tree
    optionTreeInfo() {
        return new Promise((resolve, reject) => {
            api.optionTreeInfo().then(res => {
                resolve(res)
            }).catch(error => {
                reject(error)
            })
        })
    },
    //新增
    addPatientInfo({ commit }, params) {
        return new Promise((resolve, reject) => {
            api.addPatientInfo(params).then(res => {
                resolve(res)
            }).catch(error => {
                reject(error)
            })
        })
    },
    // 详情
    patientInfoInfoDetail({ commit }, id) {
        return new Promise((resolve, reject) => {
            api.patientInfoInfoDetail(id).then(res => {
                resolve(res)
            }).catch(error => {
                reject(error)
            })
        })
    },
    // 删除
    deletePatientInfo({ commit }, id) {
        return new Promise((resolve, reject) => {
            api.deletePatientInfo(id).then(res => {
                resolve(res)
            }).catch(error => {
                reject(error)
            })
        })
    },
    // 更新
    updatePatientInfo({ commit }, params) {
        return new Promise((resolve, reject) => {
            api.updatePatientInfo(params).then(res => {
                resolve(res)
            }).catch(error => {
                reject(error)
            })
        })
    },
    //查询每个地区的各个患者属性数量
    getPatientNum() {
        return new Promise((resolve, reject) => {
            api.getPatientNum().then(res => {
                resolve(res)
            }).catch(error => {
                reject(error)
            })
        })
    },
}

const getters = {

}

const mutations = {

}

export default {
    namespaced: true,
    state,
    actions,
    getters,
    mutations
}
